<script>
	var item_i = 1;
 </script>
<div class="tableform">
	<h3>组织出入库数据</h3>
    <div class="division">
	 <form action="index.php?app=omevirtualwms&ctl=admin_wms&act=doSubmit" method="post" id="form-inventory" >
	  <input type="hidden" name='flag' value='iostock' />
	  <table width="100%" cellspacing="0" cellpadding="0" border="0" >
            <tbody>
			
              <tr>
				<th>原始业务单据号</th>
				<td><input type="text" vtype="required" name="original_bn"></td>
			  </tr>
			  <tr>
				<th>出入库流水类型</th>
				<td>
					<select name="type">
						<{foreach from=$types item=val}>
							<option value="<{$val.type_id}>"><{$val.alias_name}></option>
						<{/foreach}>
					</select>
				</td>
			</tr>
			   <tr>
				<th>OCS出入库仓库编号</th>
				<td>
				<div id="branch_select">
					<select name="warehouse" required="true">
						<{foreach from=$branchs item=branch}>
							<option value="<{$branch.branch_bn}>"><{$branch.name}></option>
						<{/foreach}>
					</select>
				</div>
				</td>
			  </tr>
              <tr>
				<th>供应商</th>
				<td><input type="text" name="supplier"></td>
			  </tr>
              <tr>
				<th>经手人</th>
				<td><input type="text" name="oper"></td>
			  </tr>
			  <tr>
				<th>备注</th>
				<td><input type="text" name="memo"></td>
			  </tr>
			  <tr>
				<th>出入库时间</th>
				<td><input type="text" name="iotime" value="<{$operate_time}>"></td>
			  </tr>
			  <tr>
				<th>task</th>
				<td><input type="text" name="task" value="<{$data.task}>"></td>
			  </tr>
            </tbody>
        </table>
		<div class="tableform">
		<div><span style="font-weight:bold;">出入库明细</span><span class="sysiconBtn addorder"  style="float:right;margin-right:150px;height:1.5em;" onclick="addInventory();">添加商品</span></div>

		<div id="listArea" class="division">
		</div>
		</div>
        <div class="table-action">
            <{button label="提交" type="submit" name="submit" id="btn-inventory"}>
        </div>
	</form>
  </div>
</div>
<script>
function addInventory(){
	var i = item_i++;
	var content='\
		<div id="inventory_'+i+'" style="margin-bottom:3px;border:1px solid #ccc;">\
		<table width="100%" cellspacing="0" cellpadding="0" border="0">\
		<tr><th>基础物料编码'+i+'</th>\
		<td><input type="text" vtype="required" name="product['+i+'][]"></td>\
		<th style="width:70px;">出入库数量'+i+'</th>\
		<td><input type="text" value="0" vtype="required" name="product['+i+'][]"></td></tr>\
		<tr><th style="width:70px;">出入库价格'+i+'</th> \
		<td><input type="text" value="0" vtype="required" name="product['+i+'][]"> </td><td><span onclick="delInventory(\'inventory_'+i+'\');" style="cursor:pointer;color:red;margin-left:100px;">X</span></td> \
		</tr>\
		<table>\
		</div>\
	';
	$E('#listArea').adopt(new Element('div').set('html',content).getFirst());
	
}
delInventory=function(o){
  $(o).remove();
}
</script> 